$(document).ready(function() {
    function type(num){
        if(num==1){
            return '专家组长'
        }else{
            return '专家组员'
        }
    }
    var grp_id = consultationinterface.getQueryString('grp_id');
    $.ajax({
        type : 'get',
        url : 'http://ekang.ren/doctor/getGrpDoctorList',
        dataType : 'jsonp',
        data : {grp_id:grp_id},
        success : function(res) {
            if(res.ret==0){
                console.log(res);
                var data = res.data.grp_doctor_list;
                $.each(data,function(i,t){
                    $('#features .content .center').append('<div data-id="'+ t.doctor_id+'"><h3 style=" padding: 0"><img src="'+ t.avatar_file+'" alt=""><div class="top"><p class="p1">'+ t.doctor_name+'</p><p class="p2">'+ t.job_name+'</p><p class="p3">'+type(t.role)+'</p></div><div class="bot">'+ t.hospital_name+'</div></h3></div>');
                });
                setTimeout(function(){
                $('.single-item').slick({
                    dots: true,
                    infinite: true,
                    speed: 300,
                    slidesToShow: 1,
                    slidesToScroll: 1
                });
                $('.multiple-items').slick({
                    dots: true,
                    infinite: true,
                    speed: 300,
                    slidesToShow: 3,
                    slidesToScroll: 3
                });
                $('.one-time').slick({
                    dots: true,
                    infinite: false,
                    placeholders: false,
                    speed: 300,
                    slidesToShow: 5,
                    touchMove: false,
                    slidesToScroll: 1
                });
                $('.uneven').slick({
                    dots: true,
                    infinite: true,
                    speed: 300,
                    slidesToShow: 4,
                    slidesToScroll: 4
                });
                $('.responsive').slick({
                    dots: true,
                    infinite: false,
                    speed: 300,
                    slidesToShow: 4,
                    slidesToScroll: 4,
                    responsive: [{
                        breakpoint: 1024,
                        settings: {
                            slidesToShow: 3,
                            slidesToScroll: 3,
                            infinite: true,
                            dots: true
                        }
                    }, {
                        breakpoint: 600,
                        settings: {
                            slidesToShow: 2,
                            slidesToScroll: 2
                        }
                    }, {
                        breakpoint: 480,
                        settings: {
                            slidesToShow: 1,
                            slidesToScroll: 1
                        }
                    }]
                });
                $('.center').slick({
                    centerMode: true,
                    centerPadding: '60px',
                    slidesToShow: 3,
                    responsive: [{
                        breakpoint: 768,
                        settings: {
                            arrows: false,
                            centerMode: true,
                            centerPadding: '40px',
                            slidesToShow: 3
                        }
                    }, {
                        breakpoint: 480,
                        settings: {
                            arrows: false,
                            centerMode: true,
                            centerPadding: '40px',
                            slidesToShow: 1
                        }
                    }]
                });
                $('.lazy').slick({
                    lazyLoad: 'ondemand',
                    slidesToShow: 3,
                    slidesToScroll: 1
                });
                $('.autoplay').slick({
                    dots: true,
                    infinite: true,
                    speed: 300,
                    slidesToShow: 3,
                    slidesToScroll: 1,
                    autoplay: true,
                    autoplaySpeed: 2000
                });
                $('.fade').slick({
                    dots: true,
                    infinite: true,
                    speed: 500,
                    fade: true,
                    slide: 'div',
                    cssEase: 'linear'
                });
                $('.add-remove').slick({
                    dots: true,
                    slidesToShow: 3,
                    slidesToScroll: 3
                });
                var slideIndex = 1;
                $('.js-add-slide').on('click', function() {
                    slideIndex++;
                    $('.add-remove').slickAdd('<div><h3>' + slideIndex + '</h3></div>');
                });
                $('.js-remove-slide').on('click', function() {
                    $('.add-remove').slickRemove(slideIndex - 1);
                    if (slideIndex !== 0){
                        slideIndex--;
                    }
                });
                $('.filtering').slick({
                    dots: true,
                    slidesToShow: 4,
                    slidesToScroll: 4
                });
                var filtered = false;
                $('.js-filter').on('click', function() {
                    if (filtered === false) {
                        $('.filtering').slickFilter(':even');
                        $(this).text('Unfilter Slides');
                        filtered = true;
                    } else {
                        $('.filtering').slickUnfilter();
                        $(this).text('Filter Slides');
                        filtered = false;
                    }
                });
                $(window).on('scroll', function() {
                    if ($(window).scrollTop() > 166) {
                        $('.fixed-header').show();
                    } else {
                        $('.fixed-header').hide();
                    }
                });
                $('ul.nav a').on('click', function(event) {
                    event.preventDefault();
                    var targetID = $(this).attr('href');
                    var targetST = $(targetID).offset().top - 48;
                    $('body, html').animate({
                        scrollTop: targetST + 'px'
                    }, 300);
                });
                },10);
            }else{
                alert(res.msg);
            }
        }
    });
});